package com.zzg.springboot.annotation.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zzg.springboot.entity.ParameObject;

/**
 * 
 * @ClassName:  ObjectController   
 * @Description:springmvc 支持對象綁定  
 * @author: 世纪伟图 -zzg
 * @date:   2018年11月5日 上午11:21:20   
 *     
 * @Copyright: 2018 www.digipower.cn 
 * 注意：本内容仅限于深圳市世纪伟图科技开发有限公司内部使用，禁止用于其他的商业目的
 */

@Controller
@RequestMapping("/api/springmvc/object")
public class ObjectController {
	/**
	 * 
	 * @Title: objectOne   
	 * @Description: springmvc 绑定对象传递(自动装箱)
	 * @param: @param sid      
	 * @return: void      
	 * @throws
	 */
	@RequestMapping(value="/objectOne", method={RequestMethod.GET})
	public void objectOne(ParameObject parame){
		System.out.println("springmvc 对象绑定：" + parame.getName() + "," + parame.getSid());
	}
	
	/**
	 * 
	 * @Title: objectOne   
	 * @Description: springmvc 绑定对象传递(自动装箱)
	 * @param: @param sid      
	 * @return: void      
	 * @throws
	 */
	@RequestMapping(value="/objectTwo", method={RequestMethod.POST})
	@ResponseBody
	public ParameObject objectTwo(@RequestBody ParameObject parame){
		System.out.println("springmvc 对象绑定：" + parame.getName() + "," + parame.getSid());
		return parame;
	}
	
	/**
	 * 
	 * @Title: objectThree   
	 * @Description: springmvc 参数自动匹配
	 * @param: @param sid      
	 * @return: void      
	 * @throws
	 */
	@RequestMapping(value="/objectThree", method={RequestMethod.GET})
	public void objectThree(Long sid,String name){
		System.out.println("springmvc 参数自动绑定：" + sid + "," + name);
	}
	
	
	

}
